using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.Admin.Data;

using UrlTable = CentralOffice.Admin.Data.UrlDataSet.UrlDataTable;
using UrlRow = CentralOffice.Admin.Data.UrlDataSet.UrlRow;
namespace CentralOffice.Admin.DataAccess
{
    public class UrlAdapter : DataAccessAdapter<Admin.Data.UrlDataSet, UrlTable, UrlRow>
    {
        public UrlAdapter()
        {
            this.TableName = "Url";
            InsertStoredProc = "Admin.Url_InsertUrl";
            DeleteStoredProc = "Admin.Url_DeleteUrl";

            GetAllStoredProc = "Admin.Url_SelectUrlAll";
            UpdateStoredProc = "Admin.Url_UpdateUrl";
            FindStoredProc = "Admin.Url_SelectUrlDynamic";
            GetByIdStoredProc = "Admin.Url_SelectUrl";

            GetPagedStoredProc = "Admin.Url_SelectUrlPaged";
            GetRowCountStoredProc = "Admin.Url_SelectUrlRowCount";
        }
        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "UrlType", DbType.String, "UrlType", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "UserId", DbType.String, "UserId", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "UrlNo", DbType.Int32, "UrlNo", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "UrlDesc", DbType.String, "UrlDesc", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "Url", DbType.String, "Url", System.Data.DataRowVersion.Current);
        }
        protected override void PopulateUpdateParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "Id", DbType.Int32, "UrlId", System.Data.DataRowVersion.Current);
            PopulateInsertParameters(db, cmd);
        }
    }
}
